//
//  UPOrderCategoryModel.m
//  LoveFreshBee
//
//  Created by wyzc on 16/6/12.
//  Copyright © 2016年 叶落知秋. All rights reserved.
//

#import "UPOrderCategoryModel.h"
#import "UPOederAllClassModel.h"

@implementation UPOrderCategoryModel

- (instancetype)initWithDict:(NSDictionary *)dict
{
    self = [super init];
    if (self) {
        self.name=dict[@"name"];
        self.iid=[dict[@"id"] intValue];
        self.flag=dict[@"flag"];
        self.sort=[dict[@"sort"] intValue];
        NSArray *cidsArr=dict[@"cids"];
        
        self.cids=[NSMutableArray array];
        //遍历category大字典中的cids数组的每一个小字典
        for (NSDictionary *cidDict in cidsArr) {
            UPOederAllClassModel *model=[UPOederAllClassModel modelWithDict:cidDict];
            [self.cids addObject:model];
        }
        
    }
    return self;
}

+(instancetype)categoryWithDict:(NSDictionary *)dict
{
    return [[self alloc]initWithDict:dict];
}

@end
